using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;

namespace libUtil
{
    public class Logger
    {
        #region Members
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(Logger));
        #endregion

        #region Constructors
        static Logger() 
        {
            Assembly ass = Assembly.GetAssembly(typeof(Logger));
            string sDir  = Path.GetDirectoryName(ass.Location);
            string sName = ass.ManifestModule.Name;
            string sCfg = string.Format("file:\\\\{0}\\{1}.config", sDir,sName);
            Uri uri = new Uri(sCfg);
            log4net.Config.XmlConfigurator.Configure(uri); 
        }
        #endregion

        #region Methods
        public static void Debug(String sMsg, params object[] args) { logger.Debug(string.Format(sMsg, args)); }
        public static void Info(String sMsg, params object[] args) { logger.Info(string.Format(sMsg, args)); }
        public static void Warn(String sMsg, params object[] args) { logger.Warn(string.Format(sMsg, args)); }
        public static void Error(String sMsg, params object[] args) { logger.Error(string.Format(sMsg, args)); }
        public static void Fatal(String sMsg, params object[] args) { logger.Fatal(string.Format(sMsg, args)); }
        #endregion
    }
}
